# 买火车票

dict_ticket={
    'G1569':['北京南-天津南','18:06','18:39','00:33'],
    'G1567':['北京南-天津南','18:15','18:49','00:34'],
    'G8917':['北京南-天津西','18:20','18:19',"00:59"],
    'G203':['北京南-天津南','18:35','19:09','00:34']
}

print('车次     出发站-到达站    出发时间    到达时间    历时时长')
#遍历字典
for key in dict_ticket.keys():
    print(key,end='\t')
    for info in dict_ticket.get(key):
        print(info,end='\t\t')
    print()
print('_'*50)

while True:
    str = input("请输入要购买的车次：")
    if dict_ticket.get(str) != None:
        break
    print("没这车！")

name = input("请输入要购买的乘客：")
info = dict_ticket.get(str)
print('您已购买了'+str+' '+info[0]+' '+info[1] +'开'+',请'+name+'尽快换取纸制车示。【铁路客服】')


